import { useLocation, useNavigate, useParams } from "react-router-dom";


// this function is used to be compatible with React Class Component
const withRouter = Component => props => {
  const location = useLocation();
  const navigate = useNavigate();
  const params = useParams();
  return <Component {...props} router={{ location, navigate, params }} />;
};

export default withRouter;
export { withRouter };
